<?php
/**
 * @desc:
 * wsxc - ShopServiceImpl.php
 * @author: quanjianyu
 * @email: 164174421@qq.com
 * @dateTime：2021/4/7 4:39
 */

namespace wsxc\api\impl;

use wsxc\api\IShopService;
use wsxc\api\IWsxcService;
use wsxc\bean\shop\LinkedShop;
use wsxc\bean\shop\ShopListResult;

class ShopServiceImpl implements IShopService {
    private IWsxcService $wsxcService;

    /**
     * ShopServiceImpl constructor.
     * @param IWsxcService $wsxcService
     */
    public function __construct(IWsxcService $wsxcService) { $this->wsxcService = $wsxcService; }

    /**
     * @desc: 获取商铺列表
     * @param string $search_value
     * @param string $act
     * @param int $page_index
     * @param string $tag_id
     * @return array
     * @author: quanjianyu
     * @email: 164174421@qq.com
     * @dateTime：2021/4/7 4:40
     */
    function getList(string $search_value = '', int $page_index = 1, string $act = 'attention', string $tag_id = ''): array {
        if (empty($act)) {
            $act = 'attention';
        }
        $shop = new LinkedShop($search_value, $page_index, $act, $tag_id);
        $baseResult = $this->wsxcService->get('/service/album/get_album_list.jsp', $shop->toArray(), ShopListResult::class);
        return $baseResult->getResult()->getShopList();
    }


}